import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入 login
import login from '../views/login'
import layout from '../views/layout'
import home from '../views/layout/home'
import movie from '../views/layout/movie'
import question from '../views/layout/question'
import user from '../views/layout/user'
Vue.use(VueRouter)
// 路由规则
const routes = [
  {
    path: '/login',
    component: login,
    name: 'login'
  },
  // 路由重定向
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/',
    name: 'layout',
    component: layout,
    children: [
      {
        path: 'home',
        name: 'home',
        component: home
      },
      {
        path: 'movie',
        name: 'movie',
        component: movie
      },
      {
        path: 'question',
        name: 'question',
        component: question
      },
      {
        path: 'user',
        name: 'user',
        component: user
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
